from django.db import models

# Create your models here.
class UserIndo(models.Model):
    name = models.CharField(max_length=16)
    age = models.IntegerField()
    regist_time = models.DateTimeField(verbose_name="时间",auto_now=True)
    acount =models.DecimalField(verbose_name="余额",max_digits=10,decimal_places=2)

class Department(models.Model):
    """部门表"""
    title = models.CharField(verbose_name="标题",max_length=16)

class UserInfo(models.Model):
    """用户表"""
    name = models.CharField(verbose_name="姓名",max_length=16)
    #级联删除
    # depart = models.ForeignKey(verbose_name="部门ID", to="Department", to_field="id", on_delete=models.CASCADE())
    # depart = models.ForeignKey(verbose_name="部门ID", to="Department", to_field="id", on_delete=models.SET_NULL,null=True,blank=True)
    depart = models.ForeignKey(verbose_name="部门ID", to="Department", to_field="id", on_delete=models.SET_DEFAULT,default=2)



class Boy(models.Model):
    name = models.CharField(verbose_name="姓名",max_length=16)

class Girl(models.Model):
    name = models.CharField(verbose_name="姓名",max_length=16)
    relation = models.ManyToManyField(verbose_name="男女关系",to="Boy")

# class B2G(models.Model):
#     bid = models.ForeignKey(verbose_name="男生ID",to="Boy",on_delete=models.CASCADE)
#     bid = models.ForeignKey(verbose_name="女生ID",to="Girl",on_delete=models.CASCADE)